package org.opensource.yabts.client;

import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.VerticalAlignment;
import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.DateItem;
import com.smartgwt.client.widgets.form.fields.TextItem;

public abstract class GeneralAsyncCallback<T> implements AsyncCallback<T> {

	public void onFailure(Throwable caught) {
		final Window winModal = new Window();
		
        winModal.setWidth(360);
        winModal.setHeight(115);
        winModal.setTitle("Modal Window");
        winModal.setShowMinimizeButton(false);
        winModal.setIsModal(true);
        winModal.setShowModalMask(true);
        winModal.centerInPage();
        DynamicForm form = new DynamicForm();
        form.setHeight100();
        form.setWidth100();
        form.setPadding(5);
        form.setLayoutAlign(VerticalAlignment.BOTTOM);
        TextItem textItem = new TextItem();
        textItem.setTitle("Text");
        DateItem dateItem = new DateItem();
        dateItem.setTitle("Date");
        DateItem dateItem2 = new DateItem();
        dateItem2.setTitle("Date");
        dateItem2.setUseTextField(true);
        form.setFields(textItem, dateItem, dateItem2);
        winModal.addItem(form);
        winModal.show();
        
	}

	public void onSuccess(Object result) {
		// TODO Auto-generated method stub
		
	}

    protected abstract void catchFailure(Throwable caught);
}
